1. Life Insurance
library("tidyr")
library("dplyr")
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library("tseries")
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
library("quantmod")
## Loading required package: xts
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
## Attaching package: 'xts'
## The following objects are masked from 'package:dplyr':
##
## first, last
## Loading required package: TTR
library("Quandl")
library("PortfolioAnalytics")
## Loading required package: foreach
## Loading required package: PerformanceAnalytics
##
## Attaching package: 'PerformanceAnalytics'
## The following object is masked from 'package:graphics':
##
## legend
library("DEoptim")
## Loading required package: parallel
##
## DEoptim package
## Differential Evolution algorithm in R
## Authors: D. Ardia, K. Mullen, B. Peterson and J. Ulrich
library("lubridate")
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
library("pdfetch")
library("kableExtra")
##
## Attaching package: 'kableExtra'
## The following object is masked from 'package:dplyr':
##
## group_rows
library("ggplot2")
library("ggpubr")
library("gt")
library("plyr")
## ------------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## ------------------------------------------------------------------------------
##
## Attaching package: 'plyr'
## The following object is masked from 'package:ggpubr':
##
## mutate
## The following objects are masked from 'package:dplyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
library("xts")
library("zoo")
library("dygraphs")
library("data.table")
##
## Attaching package: 'data.table'
## The following objects are masked from 'package:lubridate':
##
## hour, isoweek, mday, minute, month, quarter, second, wday, week,
## yday, year
## The following objects are masked from 'package:xts':
##
## first, last
## The following objects are masked from 'package:dplyr':
##
## between, first, last
library("DT")
library("formattable")
##
## Attaching package: 'formattable'
## The following object is masked from 'package:gt':
##
## currency
LifeInsurance <-c("CLI.JO",
"DSY.JO",
"MTM.JO",
"OMU.JO",
"SLM.JO")
getSymbols.yahoo(LifeInsurance,from= "2019-01-01",globalenv())
## [1] "CLI.JO" "DSY.JO" "MTM.JO" "OMU.JO" "SLM.JO"
LifeInsurance<-cbind(CLI.JO[,4],
DSY.JO[,4],
MTM.JO[,4],
OMU.JO[,4],
SLM.JO[,4])
#monthly returns
m.returns.CLI.JO<-monthlyReturn(CLI.JO,type = "arithmetic")
m.returns.DSY.JO<-monthlyReturn(DSY.JO,type = "arithmetic")
m.returns.MTM.JO<-monthlyReturn(MTM.JO,type = "arithmetic")
m.returns.OMU.JO<-monthlyReturn(OMU.JO,type = "arithmetic")
m.returns.SLM.JO<-monthlyReturn(SLM.JO,type = "arithmetic")
#colnames
colnames(m.returns.CLI.JO)<-"Clientèle Ltd."
colnames(m.returns.DSY.JO)<-"Discovery Ltd."
colnames(m.returns.MTM.JO)<-"Momentum Metropolitan Holdings Ltd."
colnames(m.returns.OMU.JO)<-"Old Mutual Ltd."
colnames(m.returns.SLM.JO)<-"Sanlam Ltd."
#combinations
LifeInsurance.returns<-cbind(m.returns.CLI.JO,
m.returns.DSY.JO,
m.returns.MTM.JO,
m.returns.OMU.JO,
m.returns.SLM.JO)
chart.CumReturns(LifeInsurance.returns,main = "Cumulative Returns TimeSeries (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(LifeInsurance.returns)
A<-table.CalendarReturns(LifeInsurance.returns)
A1<-A[,13:17]
kbl(A1)
|
|
Clientèle.Ltd.
|
Discovery.Ltd.
|
Momentum.Metropolitan.Holdings.Ltd.
|
Old.Mutual.Ltd.
|
Sanlam.Ltd.
|
|
2019
|
-2.5
|
-24.3
|
27.5
|
-8.8
|
0.5
|
|
2020
|
-40.7
|
27.3
|
-27.8
|
-39.5
|
-25.7
|
|
2021
|
14.7
|
-6.5
|
20.2
|
10.2
|
1.0
|
|
2022
|
7.4
|
-12.9
|
-4.7
|
-15.7
|
-6.9
|
#graphs
ggplot(CLI.JO, aes(x = index(CLI.JO), y = CLI.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Clientèle Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(DSY.JO, aes(x = index(DSY.JO), y = DSY.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Discovery Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(MTM.JO, aes(x = index(MTM.JO), y = MTM.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Momentum Metropolitan Holdings Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(OMU.JO, aes(x = index(OMU.JO), y = OMU.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Old Mutual Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(SLM.JO, aes(x = index(SLM.JO), y = SLM.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Sanlam Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
#metrics
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Return On Assets",
"Return On Equity",
"Market Capitalization"))
tickers <- c("CLI.JO",
"DSY.JO",
"MTM.JO",
"OMU.JO",
"SLM.JO")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
table.metrics<-metrics[,c(1,2,4,5)]
table.metrics$market_capitalization <- as.numeric(table.metrics[,4]) / 10^6
table.metrics$PE_ratio <- as.numeric(table.metrics[,2])
table.metrics$Dividend_Yields_Percent <- as.numeric(table.metrics[,3])*10000
table.metrics<-select(table.metrics, -c(2:4))
datatable(table.metrics, style = "bootstrap4")%>%
formatRound(columns=c('market_capitalization', 'PE_ratio','Dividend_Yields_Percent'), digits = 2)







2. Banks
Banks.index<-c("ABG.JO",
"CPI.JO",
"FGL.JO",
"FSR.JO",
"INL.JO",
"INP.JO",
"NED.JO",
"SBK.JO")
getSymbols.yahoo(Banks.index,from= "2019-01-01",globalenv())
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## [1] "ABG.JO" "CPI.JO" "FGL.JO" "FSR.JO" "INL.JO" "INP.JO" "NED.JO" "SBK.JO"
Banks.index1<-cbind(ABG.JO[,4],CPI.JO[,4],FGL.JO[,4],
FSR.JO[,4],INL.JO[,4],INP.JO[,4],
NED.JO[,4],SBK.JO[,4])
#monthly returns
m.returns.ABG.JO<-monthlyReturn(ABG.JO,type = "arithmetic")
m.returns.CPI.JO<-monthlyReturn(CPI.JO,type = "arithmetic")
m.returns.FGL.JO<-monthlyReturn(FGL.JO,type = "arithmetic")
m.returns.FSR.JO<-monthlyReturn(FSR.JO,type = "arithmetic")
m.returns.INL.JO<-monthlyReturn(INL.JO,type = "arithmetic")
m.returns.INP.JO<-monthlyReturn(INP.JO,type = "arithmetic")
m.returns.NED.JO<-monthlyReturn(NED.JO,type = "arithmetic")
m.returns.SBK.JO<-monthlyReturn(SBK.JO,type = "arithmetic")
#colnames
colnames(m.returns.ABG.JO)<-"Absa Group Ltd."
colnames(m.returns.CPI.JO)<-"Capitec Bank Holdings Ltd."
colnames(m.returns.FGL.JO)<-"Finbond Group Ltd."
colnames(m.returns.FSR.JO)<-"FirstRand Ltd."
colnames(m.returns.INL.JO)<-"Investec Ltd."
colnames(m.returns.INP.JO)<-"Investec plc"
colnames(m.returns.NED.JO)<-"Nedbank Group Ltd."
colnames(m.returns.SBK.JO)<-"Standard Bank Group Ltd."
#combinations
Banks.index.returns<-cbind(m.returns.ABG.JO,
m.returns.CPI.JO,
m.returns.FGL.JO,
m.returns.FSR.JO,
m.returns.INL.JO,
m.returns.INP.JO,
m.returns.NED.JO,
m.returns.SBK.JO)
A<-table.CalendarReturns(Banks.index.returns)
A1<-A[,13:20]
kbl(A1)
|
|
Absa.Group.Ltd.
|
Capitec.Bank.Holdings.Ltd.
|
Finbond.Group.Ltd.
|
FirstRand.Ltd.
|
Investec.Ltd.
|
Investec.plc
|
Nedbank.Group.Ltd.
|
Standard.Bank.Group.Ltd.
|
|
2019
|
-7.7
|
30.6
|
-36.2
|
-4.1
|
3.8
|
3.7
|
-21.7
|
-5.2
|
|
2020
|
-19.7
|
-0.9
|
-71.7
|
-18.7
|
-28.2
|
-19.5
|
-39.6
|
-24.5
|
|
2021
|
27.3
|
42.4
|
0.0
|
19.1
|
138.9
|
130.3
|
35.2
|
10.2
|
|
2022
|
36.2
|
-1.7
|
-68.7
|
10.3
|
18.1
|
21.1
|
29.8
|
29.2
|
chart.CumReturns(Banks.index.returns,main = "Cumulative Returns TimeSeries (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(Banks.index.returns)
#graphs
ggplot(ABG.JO, aes(x = index(ABG.JO), y = ABG.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Absa Group Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(CPI.JO, aes(x = index(CPI.JO), y = CPI.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Capitec Bank Holdings Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(FGL.JO, aes(x = index(FGL.JO), y = FGL.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Finbond Group Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(FSR.JO, aes(x = index(FSR.JO), y = FSR.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("FirstRand Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(INL.JO, aes(x = index(INL.JO), y = INL.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Investec Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(INP.JO, aes(x = index(INP.JO), y = INP.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Investec plc") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(NED.JO, aes(x = index(NED.JO), y = NED.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Nedbank Group Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(SBK.JO, aes(x = index(SBK.JO), y = SBK.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Standard Bank Group Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
#metrics
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Return On Assets",
"Return On Equity",
"Market Capitalization"))
tickers <- c("ABG.JO",
"CPI.JO",
"FGL.JO",
"FSR.JO",
"INL.JO",
"INP.JO",
"NED.JO",
"SBK.JO")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
table.metrics<-metrics[,c(1,2,4,5)]
table.metrics$market_capitalization <- as.numeric(table.metrics[,4]) / 10^6
table.metrics$PE_ratio <- as.numeric(table.metrics[,2])
table.metrics$Dividend_Yields_Percent <- as.numeric(table.metrics[,3])*10000
table.metrics<-select(table.metrics, -c(2:4))
datatable(table.metrics, style = "bootstrap4")%>%
formatRound(columns=c('market_capitalization', 'PE_ratio','Dividend_Yields_Percent'), digits = 2)










3. Finance and Credit Services
FinanceandCreditServices<-c("ADW.JO",
"TCP.JO")
getSymbols.yahoo(FinanceandCreditServices,from= "2019-01-01",globalenv())
## [1] "ADW.JO" "TCP.JO"
FinanceandCreditServices<-cbind(ADW.JO[,4],
TCP.JO[,4])
#monthly returns
m.returns.ADW.JO<-monthlyReturn(ADW.JO,type = "arithmetic")
m.returns.TCP.JO<-monthlyReturn(TCP.JO,type = "arithmetic")
#colnames
colnames(m.returns.ADW.JO)<-"African Dawn Capital Ltd."
colnames(m.returns.TCP.JO)<-"Transaction Capital Ltd."
#combinations
FinanceandCreditServices.returns<-cbind(m.returns.ADW.JO,
m.returns.TCP.JO)
A<-table.CalendarReturns(FinanceandCreditServices.returns)
A1<-A[,13:14]
kbl(A1)
|
|
African.Dawn.Capital.Ltd.
|
Transaction.Capital.Ltd.
|
|
2019
|
-27.3
|
24.1
|
|
2020
|
-12.5
|
18.0
|
|
2021
|
-42.9
|
80.9
|
|
2022
|
112.5
|
-13.9
|
chart.CumReturns(FinanceandCreditServices.returns,main = "Cumulative Returns TimeSeries (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(FinanceandCreditServices.returns)
#graphs
ggplot(ADW.JO, aes(x = index(ADW.JO), y = ADW.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("African Dawn Capital Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(TCP.JO, aes(x = index(TCP.JO), y = TCP.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Transaction Capital Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
#metrics
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Return On Assets",
"Return On Equity",
"Market Capitalization"))
tickers <- c("ADW.JO",
"TCP.JO")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
table.metrics<-metrics[,c(1,2,4,5)]
table.metrics$market_capitalization <- as.numeric(table.metrics[,4]) / 10^6
table.metrics$PE_ratio <- as.numeric(table.metrics[,2])
table.metrics$Dividend_Yields_Percent <- as.numeric(table.metrics[,3])*10000
table.metrics<-select(table.metrics, -c(2:4))
datatable(table.metrics, style = "bootstrap4")%>%
formatRound(columns=c('market_capitalization', 'PE_ratio','Dividend_Yields_Percent'), digits = 2)




4. Investment Banking and Brokerage Services
Investments<-c("AEE.JO",
"ATI.JO",
"AFH.JO",
"BAT.JO",
"CML.JO",
"DNB.JO",
"GPL.JO",
"HCI.JO",
"JSE.JO",
"LNF.JO",
"NY1.JO",
"N91.JO",
"PPE.JO",
"QLT.JO",
"RMI.JO",
"RNI.JO",
"REM.JO",
"SBP.JO",
"SFN.JO",
"SYG.JO",
"TTO.JO",
"UPL.JO",
"VUN.JO",
"ZED.JO")
getSymbols.yahoo(Investments,from= "2019-01-01",globalenv())
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## [1] "AEE.JO" "ATI.JO" "AFH.JO" "BAT.JO" "CML.JO" "DNB.JO" "GPL.JO" "HCI.JO"
## [9] "JSE.JO" "LNF.JO" "NY1.JO" "N91.JO" "PPE.JO" "QLT.JO" "RMI.JO" "RNI.JO"
## [17] "REM.JO" "SBP.JO" "SFN.JO" "SYG.JO" "TTO.JO" "UPL.JO" "VUN.JO" "ZED.JO"
Investments.returns<-cbind(AEE.JO[,4],
ATI.JO[,4],
AFH.JO[,4],
BAT.JO[,4],
CML.JO[,4],
DNB.JO[,4],
GPL.JO[,4],
HCI.JO[,4],
JSE.JO[,4],
LNF.JO[,4],
NY1.JO[,4],
N91.JO[,4],
PPE.JO[,4],
QLT.JO[,4],
RMI.JO[,4],
RNI.JO[,4],
REM.JO[,4],
SBP.JO[,4],
SFN.JO[,4],
SYG.JO[,4],
TTO.JO[,4],
UPL.JO[,4],
VUN.JO[,4],
ZED.JO[,4])
#monthly returns
m.returns.AEE.JO<-monthlyReturn(AEE.JO,type = "arithmetic")
m.returns.ATI.JO<-monthlyReturn(ATI.JO,type = "arithmetic")
m.returns.AFH.JO<-monthlyReturn(AFH.JO,type = "arithmetic")
m.returns.BAT.JO<-monthlyReturn(BAT.JO,type = "arithmetic")
m.returns.CML.JO<-monthlyReturn(CML.JO,type = "arithmetic")
m.returns.DNB.JO<-monthlyReturn(DNB.JO,type = "arithmetic")
m.returns.GPL.JO<-monthlyReturn(GPL.JO,type = "arithmetic")
m.returns.HCI.JO<-monthlyReturn(HCI.JO,type = "arithmetic")
m.returns.JSE.JO<-monthlyReturn(JSE.JO,type = "arithmetic")
m.returns.LNF.JO<-monthlyReturn(LNF.JO,type = "arithmetic")
m.returns.NY1.JO<-monthlyReturn(NY1.JO,type = "arithmetic")
m.returns.N91.JO<-monthlyReturn(N91.JO,type = "arithmetic")
m.returns.PPE.JO<-monthlyReturn(PPE.JO,type = "arithmetic")
m.returns.QLT.JO<-monthlyReturn(QLT.JO,type = "arithmetic")
m.returns.RMI.JO<-monthlyReturn(RMI.JO,type = "arithmetic")
m.returns.RNI.JO<-monthlyReturn(RNI.JO,type = "arithmetic")
m.returns.REM.JO<-monthlyReturn(REM.JO,type = "arithmetic")
m.returns.SBP.JO<-monthlyReturn(SBP.JO,type = "arithmetic")
m.returns.SFN.JO<-monthlyReturn(SFN.JO,type = "arithmetic")
m.returns.SYG.JO<-monthlyReturn(SYG.JO,type = "arithmetic")
m.returns.TTO.JO<-monthlyReturn(TTO.JO,type = "arithmetic")
m.returns.UPL.JO<-monthlyReturn(UPL.JO,type = "arithmetic")
m.returns.VUN.JO<-monthlyReturn(VUN.JO,type = "arithmetic")
m.returns.ZED.JO<-monthlyReturn(ZED.JO,type = "arithmetic")
#colnames
colnames(m.returns.AEE.JO)<-"African Equity Empowerment Investments Ltd."
colnames(m.returns.ATI.JO)<-"Afristrat Investment Holdings Ltd."
colnames(m.returns.AFH.JO)<-"Alexander Forbes Group Holdings Ltd."
colnames(m.returns.BAT.JO)<-"Brait PLC"
colnames(m.returns.CML.JO)<-"Coronation Fund Managers Ltd."
colnames(m.returns.DNB.JO)<-"Deneb Investments Ltd."
colnames(m.returns.GPL.JO)<-"Grand Parade Investments Ltd."
colnames(m.returns.HCI.JO)<-"Hosken Consolidated Investments Ltd."
colnames(m.returns.JSE.JO)<-"JSE Ltd."
colnames(m.returns.LNF.JO)<-"London Finance & Investment Group PLC"
colnames(m.returns.NY1.JO)<-"Ninety One Ltd."
colnames(m.returns.N91.JO)<-"Ninety One plc"
colnames(m.returns.PPE.JO)<-"Purple Group Ltd."
colnames(m.returns.QLT.JO)<-"Quilter plc"
colnames(m.returns.RMI.JO)<-"Rand Merchant Investment Holdings Ltd."
colnames(m.returns.RNI.JO)<-"Reinet Investments SCA"
colnames(m.returns.REM.JO)<-"Remgro Ltd."
colnames(m.returns.SBP.JO)<-"Sabvest Capital Ltd."
colnames(m.returns.SFN.JO)<-"Sasfin Holdings Ltd."
colnames(m.returns.SYG.JO)<-"Sygnia Ltd."
colnames(m.returns.TTO.JO)<-"Trustco Group Holdings Ltd."
colnames(m.returns.UPL.JO)<-"Universal Partners Ltd."
colnames(m.returns.VUN.JO)<-"Vunani Ltd."
colnames(m.returns.ZED.JO)<-"Zeder Investments Ltd."
#combinations
Investments.assetmana<-cbind(
m.returns.CML.JO,
m.returns.NY1.JO,
m.returns.N91.JO,
m.returns.SYG.JO,
m.returns.QLT.JO,
m.returns.VUN.JO)
Investments.less1bn<-cbind(m.returns.AEE.JO,
m.returns.ATI.JO,
m.returns.DNB.JO,
m.returns.LNF.JO,
m.returns.SFN.JO)
Investments.larger1bn<-cbind(m.returns.AFH.JO,
m.returns.BAT.JO,
m.returns.GPL.JO,
m.returns.HCI.JO,
m.returns.JSE.JO,
m.returns.PPE.JO,
m.returns.RMI.JO,
m.returns.RNI.JO,
m.returns.REM.JO,
m.returns.SBP.JO,
m.returns.TTO.JO,
m.returns.UPL.JO,
m.returns.ZED.JO)
A<-table.CalendarReturns(Investments.assetmana)
A1<-A[,13:18]
kbl(A1)
|
|
Coronation.Fund.Managers.Ltd.
|
Ninety.One.Ltd.
|
Ninety.One.plc
|
Sygnia.Ltd.
|
Quilter.plc
|
Vunani.Ltd.
|
|
2019
|
-4.3
|
NA
|
NA
|
16.0
|
33.8
|
9.1
|
|
2020
|
8.1
|
-12.0
|
-17.1
|
101.8
|
4.9
|
4.2
|
|
2021
|
21.7
|
28.4
|
26.0
|
-10.6
|
3.1
|
19.2
|
|
2022
|
-34.3
|
-27.1
|
-28.6
|
-5.6
|
-43.2
|
-0.3
|
A<-table.CalendarReturns(Investments.less1bn)
A1<-A[,13:17]
kbl(A1)
|
|
African.Equity.Empowerment.Investments.Ltd.
|
Afristrat.Investment.Holdings.Ltd.
|
Deneb.Investments.Ltd.
|
London.Finance…Investment.Group.PLC
|
Sasfin.Holdings.Ltd.
|
|
2019
|
-75.6
|
-60.0
|
-42.8
|
14.8
|
-10.9
|
|
2020
|
-15.5
|
-87.5
|
39.2
|
-99.1
|
-18.9
|
|
2021
|
-8.6
|
NA
|
-4.5
|
15.7
|
44.7
|
|
2022
|
3.5
|
-99.9
|
42.1
|
10157.1
|
-25.0
|
A<-table.CalendarReturns(Investments.larger1bn)
A1<-A[,13:25]
kbl(A1)
|
|
Alexander.Forbes.Group.Holdings.Ltd.
|
Brait.PLC
|
Grand.Parade.Investments.Ltd.
|
Hosken.Consolidated.Investments.Ltd.
|
JSE.Ltd.
|
Purple.Group.Ltd.
|
Rand.Merchant.Investment.Holdings.Ltd.
|
Reinet.Investments.SCA
|
Remgro.Ltd.
|
Sabvest.Capital.Ltd.
|
Trustco.Group.Holdings.Ltd.
|
Universal.Partners.Ltd.
|
Zeder.Investments.Ltd.
|
|
2019
|
7.8
|
-53.7
|
16.0
|
-24.2
|
-27.2
|
20.0
|
-15.0
|
25.0
|
1.9
|
NA
|
-58.2
|
21.2
|
5.8
|
|
2020
|
-28.6
|
-62.6
|
-31.3
|
-39.6
|
-5.9
|
144.4
|
3.9
|
-0.7
|
-32.5
|
2.6
|
-31.1
|
13.4
|
-45.2
|
|
2021
|
13.4
|
21.2
|
16.8
|
34.5
|
-0.4
|
219.3
|
40.9
|
3.8
|
36.3
|
105.0
|
-70.2
|
-18.2
|
24.1
|
|
2022
|
6.9
|
-5.3
|
20.0
|
135.1
|
-5.8
|
-39.5
|
-36.3
|
6.8
|
9.3
|
34.4
|
-99.7
|
-98.8
|
-45.4
|
chart.CumReturns(Investments.assetmana,main = "Cumulative Returns Asset Managers (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(Investments.assetmana, main = "Asset Managers")
chart.CumReturns(Investments.less1bn,main = "Cumulative Returns <R1bn cap (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(Investments.less1bn, main = "<R1bn cap")
chart.CumReturns(Investments.larger1bn,main = "Cumulative Returns >R1bn cap (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(Investments.larger1bn, main = "Cumulative Returns >R1bn cap")
ggplot(AEE.JO, aes(x = index(AEE.JO), y = AEE.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("African Equity Empowerment Investments Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(ATI.JO, aes(x = index(ATI.JO), y = ATI.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Afristrat Investment Holdings Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(AFH.JO, aes(x = index(AFH.JO), y = AFH.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Alexander Forbes Group Holdings Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(BAT.JO, aes(x = index(BAT.JO), y = BAT.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Brait PLC") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(CML.JO, aes(x = index(CML.JO), y = CML.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Coronation Fund Managers Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(DNB.JO, aes(x = index(DNB.JO), y = DNB.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Deneb Investments Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(GPL.JO, aes(x = index(GPL.JO), y = GPL.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Grand Parade Investments Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(HCI.JO, aes(x = index(HCI.JO), y = HCI.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Hosken Consolidated Investments Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(JSE.JO, aes(x = index(JSE.JO), y = JSE.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("JSE Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(LNF.JO, aes(x = index(LNF.JO), y = LNF.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("London Finance & Investment Group PLC") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(NY1.JO, aes(x = index(NY1.JO), y = NY1.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Ninety One Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(N91.JO, aes(x = index(N91.JO), y = N91.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Ninety One plc") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(PPE.JO, aes(x = index(PPE.JO), y = PPE.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Purple Group Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(QLT.JO, aes(x = index(QLT.JO), y = QLT.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Quilter plc") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(RMI.JO, aes(x = index(RMI.JO), y = RMI.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Rand Merchant Investment Holdings Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(RNI.JO, aes(x = index(RNI.JO), y = RNI.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Reinet Investments SCA") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(REM.JO, aes(x = index(REM.JO), y = REM.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Remgro Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(SBP.JO, aes(x = index(SBP.JO), y = SBP.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Sabvest Capital Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(SFN.JO, aes(x = index(SFN.JO), y = SFN.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Sasfin Holdings Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(SYG.JO, aes(x = index(SYG.JO), y = SYG.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Sygnia Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(TTO.JO, aes(x = index(TTO.JO), y = TTO.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Trustco Group Holdings Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(UPL.JO, aes(x = index(UPL.JO), y = UPL.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Universal Partners Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(VUN.JO, aes(x = index(VUN.JO), y = VUN.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Vunani Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(ZED.JO, aes(x = index(ZED.JO), y = ZED.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Zeder Investments Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
#metrics
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Return On Assets",
"Return On Equity",
"Market Capitalization"))
tickers <- c("AEE.JO",
"ATI.JO",
"AFH.JO",
"BAT.JO",
"CML.JO",
"DNB.JO",
"GPL.JO",
"HCI.JO",
"JSE.JO",
"LNF.JO",
"NY1.JO",
"N91.JO",
"PPE.JO",
"QLT.JO",
"RMI.JO",
"RNI.JO",
"REM.JO",
"SBP.JO",
"SFN.JO",
"SYG.JO",
"TTO.JO",
"UPL.JO",
"VUN.JO",
"ZED.JO")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
table.metrics<-metrics[,c(1,2,4,5)]
table.metrics$market_capitalization <- as.numeric(table.metrics[,4]) / 10^6
table.metrics$PE_ratio <- as.numeric(table.metrics[,2])
table.metrics$Dividend_Yields_Percent <- as.numeric(table.metrics[,3])*10000
table.metrics<-select(table.metrics, -c(2:4))
datatable(table.metrics, style = "bootstrap4")%>%
formatRound(columns=c('market_capitalization', 'PE_ratio','Dividend_Yields_Percent'), digits = 2)






























5. Non-life Insurance
NonlifeInsurance<-c("CND.JO",
"SNT.JO")
getSymbols.yahoo(NonlifeInsurance,from= "2019-01-01",globalenv())
## [1] "CND.JO" "SNT.JO"
Banks.index1<-cbind(CND.JO[,4],
SNT.JO[,4])
#monthly returns
m.returns.CND.JO<-monthlyReturn(CND.JO,type = "arithmetic")
m.returns.SNT.JO<-monthlyReturn(SNT.JO,type = "arithmetic")
#colnames
colnames(m.returns.CND.JO)<-"Conduit Capital Ltd."
colnames(m.returns.SNT.JO)<-"Santam Ltd."
#combinations
NonlifeInsurance.returns<-cbind(m.returns.CND.JO,
m.returns.SNT.JO)
A<-table.CalendarReturns(NonlifeInsurance.returns)
A1<-A[,13:14]
kbl(A1)
|
|
Conduit.Capital.Ltd.
|
Santam.Ltd.
|
|
2019
|
-16.1
|
-2.8
|
|
2020
|
-76.9
|
-12.2
|
|
2021
|
166.7
|
5.6
|
|
2022
|
-99.9
|
-1.4
|
chart.CumReturns(NonlifeInsurance.returns,main = "Cumulative Returns TimeSeries (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(NonlifeInsurance.returns)
#graphs
ggplot(CND.JO, aes(x = index(CND.JO), y = CND.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Conduit Capital Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(SNT.JO, aes(x = index(SNT.JO), y = SNT.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Santam Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
#metrics
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Return On Assets",
"Return On Equity",
"Market Capitalization"))
tickers <- c("CND.JO",
"SNT.JO")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
table.metrics<-metrics[,c(1,2,4,5)]
table.metrics$market_capitalization <- as.numeric(table.metrics[,4]) / 10^6
table.metrics$PE_ratio <- as.numeric(table.metrics[,2])
table.metrics$Dividend_Yields_Percent <- as.numeric(table.metrics[,3])*10000
table.metrics<-select(table.metrics, -c(2:4))
datatable(table.metrics, style = "bootstrap4")%>%
formatRound(columns=c('market_capitalization', 'PE_ratio','Dividend_Yields_Percent'), digits = 2)




6. Open End and Miscellaneous Investment Vehicles
InvestmentVehicles<-c(
"ARA.JO",
"BRN.JO",
"BRT.JO",
"MTNZF.JO",
"SZK.JO")
getSymbols.yahoo(InvestmentVehicles,from= "2019-01-01",globalenv())
## [1] "ARA.JO" "BRN.JO" "BRT.JO" "MTNZF.JO" "SZK.JO"
InvestmentVehicles<-cbind(
ARA.JO[,4],
BRN.JO[,4],
BRT.JO[,4],
MTNZF.JO[,4],
SZK.JO[,4])
#monthly returns
m.returns.ARA.JO<-monthlyReturn(ARA.JO,type = "arithmetic")
m.returns.BRN.JO<-monthlyReturn(BRN.JO,type = "arithmetic")
m.returns.BRT.JO<-monthlyReturn(BRT.JO,type = "arithmetic")
m.returns.MTNZF.JO<-monthlyReturn(MTNZF.JO,type = "arithmetic")
m.returns.SZK.JO<-monthlyReturn(SZK.JO,type = "arithmetic")
#colnames
colnames(m.returns.ARA.JO)<-"Astoria Investment Ltd."
colnames(m.returns.BRN.JO)<-"Brimstone Investment Corporation Ltd."
colnames(m.returns.BRT.JO)<-"Brimstone Investment Corporation Ltd."
colnames(m.returns.MTNZF.JO)<-"MTN Zakhele Futhi (RF) Ltd."
colnames(m.returns.SZK.JO)<-"SAB Zenzele Kabili Holdings (RF) Ltd."
#combinations
InvestmentVehicles.returns<-cbind(
m.returns.ARA.JO,
m.returns.BRN.JO,
m.returns.BRT.JO,
m.returns.MTNZF.JO,
m.returns.SZK.JO)
A<-table.CalendarReturns(InvestmentVehicles.returns)
A1<-A[,13:17]
kbl(A1)
|
|
Astoria.Investment.Ltd.
|
Brimstone.Investment.Corporation.Ltd.
|
Brimstone.Investment.Corporation.Ltd..1
|
MTN.Zakhele.Futhi..RF..Ltd.
|
SAB.Zenzele.Kabili.Holdings..RF..Ltd.
|
|
2019
|
-81.2
|
-19.4
|
-27.1
|
NA
|
NA
|
|
2020
|
1.3
|
-9.1
|
-18.7
|
-19.4
|
NA
|
|
2021
|
-3.8
|
-0.2
|
8.4
|
220.6
|
51.1
|
|
2022
|
44.0
|
-15.3
|
-12.7
|
-36.7
|
-42.6
|
chart.CumReturns(InvestmentVehicles.returns,main = "Cumulative Returns TimeSeries (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(InvestmentVehicles.returns)
#graphs
ggplot(ARA.JO, aes(x = index(ARA.JO), y = ARA.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Astoria Investment Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(BRN.JO, aes(x = index(BRN.JO), y = BRN.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Brimstone Investment Corporation Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(BRT.JO, aes(x = index(BRT.JO), y = BRT.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Brimstone Investment Corporation Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(MTNZF.JO, aes(x = index(MTNZF.JO), y = MTNZF.JO[,4]))+ geom_line(color = "darkblue") +
ggtitle("MTN Zakhele Futhi (RF) Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(SZK.JO, aes(x = index(SZK.JO), y = SZK.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("SAB Zenzele Kabili Holdings (RF) Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
#metrics
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Return On Assets",
"Return On Equity",
"Market Capitalization"))
tickers <- c("ARA.JO",
"BRN.JO",
"BRT.JO",
"MTNZF.JO",
"SZK.JO")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
table.metrics<-metrics[,c(1,2,4,5)]
table.metrics$market_capitalization <- as.numeric(table.metrics[,4]) / 10^6
table.metrics$PE_ratio <- as.numeric(table.metrics[,2])
table.metrics$Dividend_Yields_Percent <- as.numeric(table.metrics[,3])*10000
table.metrics<-select(table.metrics, -c(2:4))
datatable(table.metrics, style = "bootstrap4")%>%
formatRound(columns=c('market_capitalization', 'PE_ratio','Dividend_Yields_Percent'), digits = 2)







7. Precious Metals and Mining
PreciousMining<-c("AMS.JO",
"ANG.JO",
"DRD.JO",
"EPS.JO",
"GML.JO",
"GFI.JO",
"HAR.JO",
"IMP.JO",
"JBL.JO",
"NPH.JO",
"ORN.JO",
"PAN.JO",
"RNG.JO",
"RBP.JO",
"SSW.JO",
"WEZ.JO")
getSymbols.yahoo(PreciousMining,from= "2019-01-01",globalenv())
## Warning: AMS.JO contains missing values. Some functions will not work if objects
## contain missing values in the middle of the series. Consider using na.omit(),
## na.approx(), na.fill(), etc to remove or replace them.
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## [1] "AMS.JO" "ANG.JO" "DRD.JO" "EPS.JO" "GML.JO" "GFI.JO" "HAR.JO" "IMP.JO"
## [9] "JBL.JO" "NPH.JO" "ORN.JO" "PAN.JO" "RNG.JO" "RBP.JO" "SSW.JO" "WEZ.JO"
PreciousMining<-cbind(AMS.JO[,4],
ANG.JO[,4],
DRD.JO[,4],
EPS.JO[,4],
GML.JO[,4],
GFI.JO[,4],
HAR.JO[,4],
IMP.JO[,4],
JBL.JO[,4],
NPH.JO[,4],
ORN.JO[,4],
PAN.JO[,4],
RNG.JO[,4],
RBP.JO[,4],
SSW.JO[,4],
WEZ.JO[,4])
#monthly returns
m.returns.AMS.JO<-monthlyReturn(AMS.JO,type = "arithmetic")
## Warning in to_period(xx, period = on.opts[[period]], ...): missing values
## removed from data
m.returns.ANG.JO<-monthlyReturn(ANG.JO,type = "arithmetic")
m.returns.DRD.JO<-monthlyReturn(DRD.JO,type = "arithmetic")
m.returns.EPS.JO<-monthlyReturn(EPS.JO,type = "arithmetic")
m.returns.GML.JO<-monthlyReturn(GML.JO,type = "arithmetic")
m.returns.GFI.JO<-monthlyReturn(GFI.JO,type = "arithmetic")
m.returns.HAR.JO<-monthlyReturn(HAR.JO,type = "arithmetic")
m.returns.IMP.JO<-monthlyReturn(IMP.JO,type = "arithmetic")
m.returns.JBL.JO<-monthlyReturn(JBL.JO,type = "arithmetic")
m.returns.NPH.JO<-monthlyReturn(NPH.JO,type = "arithmetic")
m.returns.ORN.JO<-monthlyReturn(ORN.JO,type = "arithmetic")
m.returns.PAN.JO<-monthlyReturn(PAN.JO,type = "arithmetic")
m.returns.RNG.JO<-monthlyReturn(RNG.JO,type = "arithmetic")
m.returns.RBP.JO<-monthlyReturn(RBP.JO,type = "arithmetic")
m.returns.SSW.JO<-monthlyReturn(SSW.JO,type = "arithmetic")
m.returns.WEZ.JO<-monthlyReturn(WEZ.JO,type = "arithmetic")
#colnames
colnames(m.returns.AMS.JO)<-"Anglo American Platinum Ltd."
colnames(m.returns.ANG.JO)<-"AngloGold Ashanti Ltd."
colnames(m.returns.DRD.JO)<-"DRDGOLD Ltd."
colnames(m.returns.EPS.JO)<-"Eastern Platinum Ltd."
colnames(m.returns.GML.JO)<-"Gemfields Group Ltd."
colnames(m.returns.GFI.JO)<-"Gold Fields Ltd."
colnames(m.returns.HAR.JO)<-"Harmony Gold Mining Company Ltd."
colnames(m.returns.IMP.JO)<-"Impala Platinum Holdings Ltd."
colnames(m.returns.JBL.JO)<-"Jubilee Metals Group Plc"
colnames(m.returns.NPH.JO)<-"Northam Platinum Holdings Ltd."
colnames(m.returns.ORN.JO)<-"Orion Minerals Ltd."
colnames(m.returns.PAN.JO)<-"Pan African Resources PLC"
colnames(m.returns.RNG.JO)<-"Randgold & Exploration Co Ltd."
colnames(m.returns.RBP.JO)<-"Royal Bafokeng Platinum Ltd."
colnames(m.returns.SSW.JO)<-"Sibanye Stillwater Ltd."
colnames(m.returns.WEZ.JO)<-"Wesizwe Platinum Ltd."
#combinations
PreciousMining.returns<-cbind(m.returns.AMS.JO,
m.returns.ANG.JO,
m.returns.DRD.JO,
m.returns.EPS.JO,
m.returns.GML.JO,
m.returns.GFI.JO,
m.returns.HAR.JO,
m.returns.IMP.JO,
m.returns.JBL.JO,
m.returns.NPH.JO,
m.returns.ORN.JO,
m.returns.PAN.JO,
m.returns.RNG.JO,
m.returns.RBP.JO,
m.returns.SSW.JO,
m.returns.WEZ.JO)
A<-table.CalendarReturns(PreciousMining.returns)
A1<-A[,13:28]
kbl(A1)
|
|
Anglo.American.Platinum.Ltd.
|
AngloGold.Ashanti.Ltd.
|
DRDGOLD.Ltd.
|
Eastern.Platinum.Ltd.
|
Gemfields.Group.Ltd.
|
Gold.Fields.Ltd.
|
Harmony.Gold.Mining.Company.Ltd.
|
Impala.Platinum.Holdings.Ltd.
|
Jubilee.Metals.Group.Plc
|
Northam.Platinum.Holdings.Ltd.
|
Orion.Minerals.Ltd.
|
Pan.African.Resources.PLC
|
Randgold…Exploration.Co.Ltd.
|
Royal.Bafokeng.Platinum.Ltd.
|
Sibanye.Stillwater.Ltd.
|
Wesizwe.Platinum.Ltd.
|
|
2019
|
145.1
|
73.8
|
135.8
|
53.8
|
8.2
|
92.2
|
96.9
|
297.7
|
56.2
|
NA
|
-14.3
|
36.7
|
-17.5
|
76.2
|
NA
|
21.4
|
|
2020
|
10.4
|
8.2
|
139.6
|
57.7
|
-26.6
|
43.5
|
39.8
|
40.7
|
253.3
|
NA
|
41.7
|
122.2
|
-28.0
|
31.8
|
24.2
|
-2.0
|
|
2021
|
25.9
|
-4.0
|
-26.5
|
-11.2
|
125.2
|
26.6
|
-7.0
|
11.4
|
34.3
|
17.8
|
-14.7
|
-20.0
|
5.3
|
139.1
|
-18.2
|
124.0
|
|
2022
|
-9.6
|
-3.4
|
-12.7
|
-23.1
|
15.1
|
7.8
|
-6.7
|
-10.8
|
-31.2
|
-9.4
|
-24.1
|
-5.7
|
-9.0
|
6.8
|
-9.2
|
4.5
|
chart.CumReturns(PreciousMining.returns,main = "Cumulative Returns TimeSeries (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(PreciousMining.returns)
#graphs
ggplot(ANG.JO, aes(x = index(AMS.JO), y = AMS.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Anglo American Platinum Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
ggplot(ANG.JO, aes(x = index(ANG.JO), y = ANG.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("AngloGold Ashanti Ltd..") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(DRD.JO, aes(x = index(DRD.JO), y = DRD.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("DRDGOLD Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(EPS.JO, aes(x = index(EPS.JO), y = EPS.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Eastern Platinum Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(GML.JO, aes(x = index(GML.JO), y = GML.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Gemfields Group Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(GFI.JO, aes(x = index(GFI.JO), y = GFI.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Gold Fields Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(HAR.JO, aes(x = index(HAR.JO), y = HAR.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Harmony Gold Mining Company Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(IMP.JO, aes(x = index(IMP.JO), y = IMP.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Impala Platinum Holdings Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(JBL.JO, aes(x = index(JBL.JO), y = JBL.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Jubilee Metals Group Plc") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(NPH.JO, aes(x = index(NPH.JO), y = NPH.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Northam Platinum Holdings Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(ORN.JO, aes(x = index(ORN.JO), y = ORN.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Orion Minerals Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(PAN.JO, aes(x = index(PAN.JO), y = PAN.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Pan African Resources PLC") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(RNG.JO, aes(x = index(RNG.JO), y = RNG.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Randgold & Exploration Co Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(RBP.JO, aes(x = index(RBP.JO), y = RBP.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Royal Bafokeng Platinum Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(SSW.JO, aes(x = index(SSW.JO), y = SSW.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Sibanye Stillwater Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(WEZ.JO, aes(x = index(WEZ.JO), y = WEZ.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Wesizwe Platinum Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
#metrics
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Return On Assets",
"Return On Equity",
"Market Capitalization"))
tickers <- c("AMS.JO",
"ANG.JO",
"DRD.JO",
"EPS.JO",
"GML.JO",
"GFI.JO",
"HAR.JO",
"IMP.JO",
"JBL.JO",
"NPH.JO",
"ORN.JO",
"PAN.JO",
"RNG.JO",
"RBP.JO",
"SSW.JO",
"WEZ.JO")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
table.metrics<-metrics[,c(1,2,4,5)]
table.metrics$market_capitalization <- as.numeric(table.metrics[,4]) / 10^6
table.metrics$PE_ratio <- as.numeric(table.metrics[,2])
table.metrics$Dividend_Yields_Percent <- as.numeric(table.metrics[,3])*10000
table.metrics<-select(table.metrics, -c(2:4))
datatable(table.metrics, style = "bootstrap4")%>%
formatRound(columns=c('market_capitalization', 'PE_ratio','Dividend_Yields_Percent'), digits = 2)


















8. Personal Care, Drug and Grocery Stores
Grocery<-c("BID.JO",
"CHP.JO",
"CLS.JO",
"DCP.JO",
"PIK.JO",
"SHP.JO",
"SPP.JO")
getSymbols.yahoo(Grocery,from= "2019-01-01",globalenv())
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## pausing 1 second between requests for more than 5 symbols
## [1] "BID.JO" "CHP.JO" "CLS.JO" "DCP.JO" "PIK.JO" "SHP.JO" "SPP.JO"
Grocery<-cbind(BID.JO[,4],
CHP.JO[,4],
CLS.JO[,4],
DCP.JO[,4],
PIK.JO[,4],
SHP.JO[,4],
SPP.JO[,4])
#monthly returns
m.returns.BID.JO<-monthlyReturn(BID.JO,type = "arithmetic")
m.returns.CHP.JO<-monthlyReturn(CHP.JO,type = "arithmetic")
m.returns.CLS.JO<-monthlyReturn(CLS.JO,type = "arithmetic")
m.returns.DCP.JO<-monthlyReturn(DCP.JO,type = "arithmetic")
m.returns.PIK.JO<-monthlyReturn(PIK.JO,type = "arithmetic")
m.returns.SHP.JO<-monthlyReturn(SHP.JO,type = "arithmetic")
m.returns.SPP.JO<-monthlyReturn(SPP.JO,type = "arithmetic")
#colnames
colnames(m.returns.BID.JO)<-"Bid Corporation"
colnames(m.returns.CHP.JO)<-"Choppies Enterprises"
colnames(m.returns.CLS.JO)<-"Clicks Group"
colnames(m.returns.DCP.JO)<-"Dischem Pharmacies"
colnames(m.returns.PIK.JO)<-"Pick and Pay"
colnames(m.returns.SHP.JO)<-"Shoprite Holdings"
colnames(m.returns.SPP.JO)<-"The Spar Group"
#combinations
Grocery.returns<-cbind(m.returns.BID.JO,
m.returns.CHP.JO,m.returns.CLS.JO,m.returns.DCP.JO,m.returns.PIK.JO,m.returns.SHP.JO,m.returns.SPP.JO)
A<-table.CalendarReturns(Grocery.returns)
A1<-A[,13:19]
kbl(A1)
|
|
Bid.Corporation
|
Choppies.Enterprises
|
Clicks.Group
|
Dischem.Pharmacies
|
Pick.and.Pay
|
Shoprite.Holdings
|
The.Spar.Group
|
|
2019
|
25.1
|
NA
|
34.3
|
-9.6
|
-4.6
|
-33.7
|
-3.5
|
|
2020
|
-20.3
|
9.4
|
-1.5
|
-20.7
|
-21.3
|
11.2
|
-4.0
|
|
2021
|
24.1
|
11.4
|
24.9
|
68.6
|
4.4
|
49.2
|
-11.8
|
|
2022
|
4.6
|
-1.3
|
-7.0
|
-14.2
|
20.0
|
20.7
|
-16.8
|
chart.CumReturns(Grocery.returns,main = "Cumulative Returns TimeSeries (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(Grocery.returns)
#graphs
ggplot(DCP.JO, aes(x = index(DCP.JO), y = DCP.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Bid Corporation") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(CHP.JO, aes(x = index(CHP.JO), y = CHP.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Choppies Enterprises") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(CLS.JO, aes(x = index(CLS.JO), y = CLS.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Clicks Group") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(DCP.JO, aes(x = index(DCP.JO), y = DCP.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Dischem Pharmacies") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(PIK.JO, aes(x = index(PIK.JO), y = PIK.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Pick and Pay") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(SHP.JO, aes(x = index(SHP.JO), y = SHP.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Shoprite Holdings") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(SPP.JO, aes(x = index(SPP.JO), y = SPP.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("The Spar Group") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
#metrics
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Return On Assets",
"Return On Equity",
"Market Capitalization"))
tickers <- c("BID.JO",
"CHP.JO",
"CLS.JO",
"DCP.JO",
"PIK.JO",
"SHP.JO",
"SPP.JO")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
table.metrics<-metrics[,c(1,2,4,5)]
table.metrics$market_capitalization <- as.numeric(table.metrics[,4]) / 10^6
table.metrics$PE_ratio <- as.numeric(table.metrics[,2])
table.metrics$Dividend_Yields_Percent <- as.numeric(table.metrics[,3])*10000
table.metrics<-select(table.metrics, -c(2:4))
datatable(table.metrics, style = "bootstrap4")%>%
formatRound(columns=c('market_capitalization', 'PE_ratio','Dividend_Yields_Percent'), digits = 2)









9. Alternative Energy
AltEn<-c("REN.JO",
"MKR.JO")
getSymbols.yahoo(AltEn,from= "2019-01-01",globalenv())
## [1] "REN.JO" "MKR.JO"
AltEn<-cbind(REN.JO[,4],
MKR.JO[,4])
#monthly returns
m.returns.REN.JO<-monthlyReturn(REN.JO,type = "arithmetic")
m.returns.MKR.JO<-monthlyReturn(MKR.JO,type = "arithmetic")
#colnames
colnames(m.returns.REN.JO)<-"Montauk Renewables Inc"
colnames(m.returns.MKR.JO)<-"Renergen Ltd"
#combinations
AltEn.returns<-cbind(m.returns.REN.JO,
m.returns.MKR.JO)
A<-table.CalendarReturns(AltEn.returns)
A1<-A[,13:14]
kbl(A1)
|
|
Montauk.Renewables.Inc
|
Renergen.Ltd
|
|
2019
|
63.8
|
NA
|
|
2020
|
-7.8
|
NA
|
|
2021
|
172.3
|
2.7
|
|
2022
|
-23.6
|
22.7
|
chart.CumReturns(AltEn.returns,main = "Cumulative Returns TimeSeries (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(AltEn.returns)
#graphs
ggplot(REN.JO, aes(x = index(REN.JO), y = REN.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Renergen Ltd") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(MKR.JO, aes(x = index(MKR.JO), y = MKR.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Montauk Renewables Inc") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
#metrics
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Return On Assets",
"Return On Equity",
"Market Capitalization"))
tickers <- c("REN.JO",
"MKR.JO")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
table.metrics<-metrics[,c(1,2,4,5)]
table.metrics$market_capitalization <- as.numeric(table.metrics[,4]) / 10^6
table.metrics$PE_ratio <- as.numeric(table.metrics[,2])
table.metrics$Dividend_Yields_Percent <- as.numeric(table.metrics[,3])*10000
table.metrics<-select(table.metrics, -c(2:4))
datatable(table.metrics, style = "bootstrap4")%>%
formatRound(columns=c('market_capitalization', 'PE_ratio','Dividend_Yields_Percent'), digits = 2)




10. Automobiles and Parts
Auto<-c("MTA.JO")
getSymbols.yahoo(Auto,from= "2019-01-01",globalenv())
## [1] "MTA.JO"
Auto<-cbind(MTA.JO[,4])
#monthly returns
m.returns.MTA.JO<-monthlyReturn(MTA.JO,type = "arithmetic")
#colnames
colnames(m.returns.MTA.JO)<-"Metair Investments Ltd"
#combinations
Auto.returns<-cbind(m.returns.MTA.JO)
A<-table.CalendarReturns(Auto.returns)
kbl(A)
|
|
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Metair Investments Ltd
|
|
2019
|
-1.8
|
7.7
|
13.9
|
2.5
|
0.3
|
0.0
|
1.3
|
-7.8
|
4.5
|
6.7
|
-3.9
|
-2.1
|
21.6
|
|
2020
|
1.1
|
-11.4
|
-32.3
|
6.1
|
-9.0
|
33.6
|
-0.3
|
1.9
|
-2.5
|
-7.8
|
4.5
|
8.7
|
-18.8
|
|
2021
|
-0.2
|
-3.0
|
24.4
|
0.8
|
1.1
|
-2.2
|
7.2
|
15.7
|
9.7
|
-5.3
|
-7.2
|
2.2
|
46.7
|
|
2022
|
5.3
|
-3.3
|
7.1
|
-5.9
|
-2.3
|
-11.2
|
10.5
|
-1.9
|
1.7
|
2.6
|
4.3
|
NA
|
5.1
|
chart.CumReturns(Auto.returns,main = "Cumulative Returns TimeSeries (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(Auto.returns)
#graphs
ggplot(MTA.JO, aes(x = index(MTA.JO), y = MTA.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Metair Investments Ltd") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
#metrics
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Return On Assets",
"Return On Equity",
"Market Capitalization"))
tickers <- c("MTA.JO")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
table.metrics<-metrics[,c(1,2,4,5)]
table.metrics$market_capitalization <- as.numeric(table.metrics[,4]) / 10^6
table.metrics$PE_ratio <- as.numeric(table.metrics[,2])
table.metrics$Dividend_Yields_Percent <- as.numeric(table.metrics[,3])*10000
table.metrics<-select(table.metrics, -c(2:4))
datatable(table.metrics, style = "bootstrap4")%>%
formatRound(columns=c('market_capitalization', 'PE_ratio','Dividend_Yields_Percent'), digits = 2)



11. Beverages
Bev<-c("ANH.JO",
"DGH.JO")
getSymbols.yahoo(Bev,from= "2019-01-01",globalenv())
## [1] "ANH.JO" "DGH.JO"
Bev<-cbind(ANH.JO[,4],
DGH.JO[,4])
#monthly returns
m.returns.ANH.JO<-monthlyReturn(ANH.JO,type = "arithmetic")
m.returns.DGH.JO<-monthlyReturn(DGH.JO,type = "arithmetic")
#colnames
colnames(m.returns.ANH.JO)<-"Anheuser-Busch InBev"
colnames(m.returns.DGH.JO)<-"Distell Group Holdings Ltd."
#combinations
Bev.returns<-cbind(m.returns.ANH.JO,
m.returns.DGH.JO)
A<-table.CalendarReturns(Bev.returns)
A1<-A[,13:14]
kbl(A1)
|
|
Anheuser.Busch.InBev
|
Distell.Group.Holdings.Ltd.
|
|
2019
|
21.2
|
24.1
|
|
2020
|
-10.1
|
-28.4
|
|
2021
|
-7.3
|
77.6
|
|
2022
|
0.9
|
3.1
|
chart.CumReturns(Bev.returns,main = "Cumulative Returns TimeSeries (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(Bev.returns)
#graphs
ggplot(ANH.JO, aes(x = index(ANH.JO), y = ANH.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Anheuser-Busch InBev") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(DGH.JO, aes(x = index(DGH.JO), y = DGH.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Distell Group Holdings Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
#metrics
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Return On Assets",
"Return On Equity",
"Market Capitalization"))
tickers <- c("ANH.JO",
"DGH.JO")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
table.metrics<-metrics[,c(1,2,4,5)]
table.metrics$market_capitalization <- as.numeric(table.metrics[,4]) / 10^6
table.metrics$PE_ratio <- as.numeric(table.metrics[,2])
table.metrics$Dividend_Yields_Percent <- as.numeric(table.metrics[,3])*10000
table.metrics<-select(table.metrics, -c(2:4))
datatable(table.metrics, style = "bootstrap4")%>%
formatRound(columns=c('market_capitalization', 'PE_ratio','Dividend_Yields_Percent'), digits = 2)




12. Chemicals
Chem<-c("AFE.JO",
"OMN.JO","SOLBE1.JO",
"SOL.JO")
getSymbols.yahoo(Chem,from= "2019-01-01",globalenv())
## Warning: SOL.JO contains missing values. Some functions will not work if objects
## contain missing values in the middle of the series. Consider using na.omit(),
## na.approx(), na.fill(), etc to remove or replace them.
## [1] "AFE.JO" "OMN.JO" "SOLBE1.JO" "SOL.JO"
Chem<-cbind(AFE.JO[,4],
OMN.JO[,4],SOLBE1.JO[,4],
SOL.JO[,4])
#monthly returns
m.returns.AFE.JO<-monthlyReturn(AFE.JO,type = "arithmetic")
m.returns.OMN.JO<-monthlyReturn(OMN.JO,type = "arithmetic")
m.returns.SOLBE1.JO<-monthlyReturn(SOLBE1.JO,type = "arithmetic")
m.returns.SOL.JO<-monthlyReturn(SOL.JO,type = "arithmetic")
## Warning in to_period(xx, period = on.opts[[period]], ...): missing values
## removed from data
#colnames
colnames(m.returns.AFE.JO)<-"AECI"
colnames(m.returns.OMN.JO)<-"OMNIA"
colnames(m.returns.SOLBE1.JO)<-"BEE-SASOL"
colnames(m.returns.SOL.JO)<-"SASOL"
#combinations
Chem.returns<-cbind(m.returns.AFE.JO,
m.returns.OMN.JO,m.returns.SOLBE1.JO,
m.returns.SOL.JO)
A<-table.CalendarReturns(Chem.returns)
A1<-A[,13:16]
kbl(A1)
|
|
AECI
|
OMNIA
|
BEE.SASOL
|
SASOL
|
|
2019
|
25.6
|
-39.3
|
21.7
|
-27.8
|
|
2020
|
-18.7
|
36.6
|
-69.6
|
-55.9
|
|
2021
|
28.7
|
38.9
|
84.2
|
93.4
|
|
2022
|
-15.2
|
9.7
|
22.5
|
14.8
|
chart.CumReturns(Chem.returns,main = "Cumulative Returns TimeSeries (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(Chem.returns)
#graphs
ggplot(AFE.JO, aes(x = index(AFE.JO), y = AFE.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("AECI") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(OMN.JO, aes(x = index(OMN.JO), y = OMN.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("OMNIA") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(SOLBE1.JO, aes(x = index(SOLBE1.JO), y = SOLBE1.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("BEE-SASOL") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(SOL.JO, aes(x = index(SOL.JO), y = SOL.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("SASOL") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
#metrics
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Return On Assets",
"Return On Equity",
"Market Capitalization"))
tickers <- c("AFE.JO",
"OMN.JO","SOLBE1.JO",
"SOL.JO")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
table.metrics<-metrics[,c(1,2,4,5)]
table.metrics$market_capitalization <- as.numeric(table.metrics[,4]) / 10^6
table.metrics$PE_ratio <- as.numeric(table.metrics[,2])
table.metrics$Dividend_Yields_Percent <- as.numeric(table.metrics[,3])*10000
table.metrics<-select(table.metrics, -c(2:4))
datatable(table.metrics, style = "bootstrap4")%>%
formatRound(columns=c('market_capitalization', 'PE_ratio','Dividend_Yields_Percent'), digits = 2)






11. Technology Hardware and Equipment
Tech<-c("AVV.JO",
"MST.JO")
getSymbols.yahoo(Tech,from= "2019-01-01",globalenv())
## [1] "AVV.JO" "MST.JO"
Tech<-cbind(AVV.JO[,4],
MST.JO[,4])
#monthly returns
m.returns.AVV.JO<-monthlyReturn(AVV.JO,type = "arithmetic")
m.returns.MST.JO<-monthlyReturn(MST.JO,type = "arithmetic")
#colnames
colnames(m.returns.AVV.JO)<-"Alviva Holdings Ltd."
colnames(m.returns.MST.JO)<-"Mustek Ltd."
#combinations
Tech.returns<-cbind(m.returns.AVV.JO,
m.returns.MST.JO)
A<-table.CalendarReturns(Tech.returns)
A1<-A[,13:14]
kbl(A1)
|
|
Alviva.Holdings.Ltd.
|
Mustek.Ltd.
|
|
2019
|
-14.0
|
22.9
|
|
2020
|
-36.2
|
-10.1
|
|
2021
|
79.5
|
58.3
|
|
2022
|
44.0
|
8.9
|
chart.CumReturns(Tech.returns,main = "Cumulative Returns TimeSeries (growth of 1 Rand)", legend.loc = "topleft")
chart.RiskReturnScatter(Tech.returns)
#graphs
ggplot(AVV.JO, aes(x = index(AVV.JO), y = AVV.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Alviva Holdings Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
ggplot(MST.JO, aes(x = index(MST.JO), y = MST.JO[,4])) + geom_line(color = "darkblue") +
ggtitle("Mustek Ltd.") + xlab("Date") + ylab("Price") +
theme(plot.title = element_text(hjust = 0.5)) +
scale_x_date(date_labels = "%b %y", date_breaks = "3 months")+geom_smooth(method = "lm", color = "red")+
labs(subtitle = "Log scale, Linear Trendline")
## Don't know how to automatically pick scale for object of type xts/zoo. Defaulting to continuous.
## `geom_smooth()` using formula 'y ~ x'
#metrics
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Return On Assets",
"Return On Equity",
"Market Capitalization"))
tickers <- c("AVV.JO",
"MST.JO")
metrics <- getQuote(paste(tickers, sep="", collapse=";"), what=what_metrics)
table.metrics<-metrics[,c(1,2,4,5)]
table.metrics$market_capitalization <- as.numeric(table.metrics[,4]) / 10^6
table.metrics$PE_ratio <- as.numeric(table.metrics[,2])
table.metrics$Dividend_Yields_Percent <- as.numeric(table.metrics[,3])*10000
table.metrics<-select(table.metrics, -c(2:4))
datatable(table.metrics, style = "bootstrap4")%>%
formatRound(columns=c('market_capitalization', 'PE_ratio','Dividend_Yields_Percent'), digits = 2)



